unit U_fm_pesq_grupo;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Vcl.Grids, Vcl.DBGrids,
  Vcl.StdCtrls, Vcl.Buttons, Vcl.ExtCtrls;

type
  Tfm_pesq_grupo = class(TForm)
    Panel1: TPanel;
    lbl_item: TLabel;
    edt_descricao: TEdit;
    btn_loc: TBitBtn;
    DBGrid1: TDBGrid;
    Panel3: TPanel;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    DataSource1: TDataSource;
    procedure FormShow(Sender: TObject);
    procedure btn_locClick(Sender: TObject);

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fm_pesq_grupo: Tfm_pesq_grupo;

implementation

{$R *.dfm}

uses U_dm_principal;

procedure Tfm_pesq_grupo.btn_locClick(Sender: TObject);
begin
       dm_principal.cds_grupo.Close;
       dm_principal.sq_grupo.SQL.Text:= 'select g.codigo,'
                                            +#13+'g.grupo '
                                            +#13+'from grupo g '
                                            +#13+' where g.grupo<> ' + QuotedStr('');
         if  length(trim(edt_descricao.Text))>0 then
             dm_principal.sq_grupo.SQL.Add(' and g.grupo containing '+QuotedStr(edt_descricao.Text));
              dm_principal.cds_grupo.Open;
end;

procedure Tfm_pesq_grupo.FormShow(Sender: TObject);
begin
dm_principal.cds_grupo.Open;
end;

   end.

